package gweb

func (app *GinApp) BeforeRun(f EventHandler) {
	handlers := app.events["BeforeRun"]
	if handlers == nil {
		app.events["BeforeRun"] = []EventHandler{}
	}
	handlers = app.events["BeforeRun"]
	handlers = append(handlers, f)
	app.events["BeforeRun"] = handlers
}

func (app *GinApp) OnError(f EventHandler) {
	handlers := app.events["OnError"]
	if handlers == nil {
		app.events["OnError"] = []EventHandler{}
	}
	handlers = app.events["OnError"]
	handlers = append(handlers, f)
	app.events["OnError"] = handlers
}
